This page last changed on Mar 08, 2007 by bowens.

Overview

A pyramid is several layers of the original image that have been shrunk down into smaller and smaller steps, each one to be rendered at different zoom levels. So, when you start zoomed out, you will view the smaller version of the original image. As you zoom in you will start to view versions of the original image that are getting larger and closer to the original image size.
Below is an example of how it might look. It lists each level, the scale of the original image that each level is, and the size of the image at that level:

Level Scale Image Size Zoom
7 1/64 312.5 kB Zoomed out
6 1/32 625 kB
5 1/16 1,250 kB
4 1/8 2,500 kB Mid-way
3 1/4 5,000 kB
2 1/2 10,000 kB
1 1 20,000 kB Zoomed right in

Above, each layer is half the size of the previous layer; the starting image is the 20,000 kB image.

Having the image divided into levels like that helps performance a lot, but only if we are zoomed out. As soon as we start zooming in we will start hitting the large original image (20,000 kB one). In order to speed up that layer, and some of the layers in between, we need to chop them up and create a mosaic out of them. This is called tiling. How this works is that only the tiles that are currently in the bounding box will be rendered.

In the end, the pyramid will contain several layers of image mosaics.

For a detailed tutorial on how to build an Image Pyramid from the Blue Marble dataset, visit this page.

Directory Structure

The layout of your pyramid should look something like this:

+pyramid/
  +0/
    +img_1.tiff
    +img_2.tiff
    +....
    +pyramid.properties
    +...
  +2/
  +4/
  +8/
  +16/
  +pyramid.prj
  +pyramid.properties

At the root of your image pyramid there will be a .properties and a .prj file. The properties file contains the bounds, file name, pixel size (levels), and directories containing the levels of the pyramid.
Inside each sub directory (0,2,4,6,8,16...) there will be an image mosaic with its corresponding .properties file.

Generating a Pyramid With the Coverage Tools.

You can check out the source code and project for the coverage tools with SVN here: *http://svn.geotools.org/geotools/branches/2.3.x/*
The coverage tools can be found under: /geotools/branches/2.3.x/ext/coverage_development

Make sure you have Maven installed, there are instructions on the developers guide for GeoServer for how to do that.
With maven set up navigate to the root of the geotools source you just checked out and type:

mvn clean install

Next, navigate to geotools/branches/2.3.x/ext/coverage_development and type:

mvn clean install

Then type:

mvn eclipse:eclipse

This will create an eclipse project you so can run the tools form the IDE.

Next, start up Eclipse and import the project from the geotools/branches/2.3.x/ext/coverage_development directory.

Create a a new Run... task with the following parameters:

Main Class: it.geosolutions.utils.imagepyramid.PyramidBuilder
Arguments:
    Program Arguments: -s path/to/tiffFile.tiff -f 2 -n 4 -t "1024,1024" -w
    VM Arguments: -Xmx512m

-s is the path to your original TIFF file that will be shopped up.
-f is the scale factor to shrink the layer by for each level.
-n is the number of levels to generate. For example, 2 will generate directories 0,2,4; 4 will generate 0,2,4,8,16
-t the dimentions of the individual tiles that the original image will be chopped up into
-w leave it blank

The path to the file can be the full path to the image file.

Once the parameters are set up, run the program and it will generate your pyramid, hopefully without errors.

Load the Pyramid Into GeoServer

1) Start up GeoServer, then navigate to Config->Data->CoverageStores->New

2) Select Image Pyramidal Plugin then enter a name for your pyramid. Hit the New button.

3) You will now be at the CoverageStore edit screen. Enter in the location of the pyramid. If it is in the data directory, then it can be referenced relatively to it. If it is somewhere else on your file system, you can give it the absolute path.
The file you want to point at is the pyramid.properties file at the root of the pyramid structure that was generated.
When finished, hit the Submit button.

4) Navigate to the Config->Data->Coverages-New menu:

5) Select your coverage store from the drop down list and hit New.

6) You are now at the Coverage edit screen. Simply scroll to the bottom and hit Submit, then Apply and Save. You will now be able to view the Pyramid through GeoServer.


Document generated by Confluence on Jan 16, 2008 23:27